Creating
a gambas2
program,
step by step, a telephone index
From : http://listingambas.blogspot.com/2011/06/formulario-y-modulo-fechas.html
Form and
Module: Dates
Facing
how uncomfortable is the input of a
date, with various possible layout of it (the Spanish format can put
01/12/2010,
American 2010/12/01, or "first of December of two thousand ten"), we
will improve the process to enter the date of our data, and make it easiest
by
displaying a small
form
with a calendar to which
we pass the format year / month / day (the better design when sorting
by date).
For
this we will create a little button ToolButtonCalendar
,
which calls,
when
clicked, a new form FCalendar.AskForDate
,

PUBLIC
SUB
ToolButtonCalendar_Click ()
Fcalendar.
Askfordate
END
We
create a new form, call it FCalendar,
with an
"OK" button and a DateChooser
named
datechooserdate, where we can ... choose the date!

And with the following code within the FCalendar form:
'Gambas
class file
PUBLIC
SUB
DateChooserDate_Change ()
ME . Caption
=
DateChooserDate. Value
END
PUBLIC
SUB
Form_Open ()
ME . Caption
=
DateChooserDate. Value
END
PUBLIC
SUB
AskForDate ()
FCalendar.
ShowModal
END
PUBLIC
SUB
ButtonOk_Click ()
FMain.
TextBoxDate.
text
=
Format
(Fcalendar. DateChooserDate.
Value
, "yyyy
/ mm / dd"
)
ME
. Close
END
The
most interesting feature is Format
, which convert reading of the date from DateChooserDate
in year / month / day format: "yyyy
/ mm / dd"